package com.tianqu.tms.www.transfer.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAjaxAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.exception.TmsException;
import com.tianqu.tms.entity.Attn;

public class TransferRgAjaxAction extends TmsAjaxAction {
	private Logger logger = Logger.getLogger(TransferRgAjaxAction.class);
	public static final String SERIAL = "serial";
	public static final String OWNERNAME = "ownerName";

	@Override
	public void process(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws TmsException {
		logger.debug(this.getClass().getName() + "#execute was called.");
		String attnId = request.getParameter("attnId");
		Attn attn = new Attn();
		attn = attn.getIntegralManagementInfo(attnId);
		String str = "";
		
		StringBuffer str1 = new StringBuffer();
		if(attn!=null)
		{
			
			str1.append(""
					+ "<div class='checkB1'>"
					+ "<div class='checkB1' >"
					+ "<div class='cktp' onmouseover='shPhoto(this,1)' onmouseout='shPhoto(this,0)'>"
					+ "<a href='javascript:;' class='查看图片' >"+attn.getAttnName()+"</a>" 
					+ "<div class='hiddenDiv'><img src='"+attn.getAttnPhoto()+"' /></div></div></div></div>");	
			if("1".equals(attn.getUserId())){
				str1.append("&nbsp;&nbsp;(正常)");
			}else if("2".equals(attn.getUserId()) || "3".equals(attn.getUserId())){
				str1.append("&nbsp;&nbsp;(异常)");
			}
			
		}else{
			str1.append("");
		}
		

		//向前台打一个字符窜
		if(attn!=null)
		{
			str = attn.getAttnId()+","+attn.getCardScore()+","+attn.getUserId()+","+str1.toString();
		}
		responseValues(response, str, TEXT);
		logger.debug(this.getClass().getName() + "#execute was completed.");

	}

}
